/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.forms.renderers;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author david
 */
public class ZeroSuppressionCellRenderer extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {

        if (value instanceof Double && (Double)value == 0.0) {
            value = "";
        } else if (value instanceof Float && (Float)value == 0.0) {
            value = "";
        } else if (value instanceof Integer && (Integer)value == 0) {
            value = "";
        } else if (value instanceof Short && (Short)value == 0) {
            value = "";
        } else if (value instanceof Byte && (Byte)value == 0) {
            value = "";
        }
        
        return super.getTableCellRendererComponent(table, value, isSelected,
                hasFocus, row, column);
    }
}
